package sampleproj;

import java.text.SimpleDateFormat;

import java.util.Calendar;
import java.util.Date;

public class Class1 {
  public Class1() {
  }
  public static void main(String[] args) {
    System.out.println("Tim ngay dong Cycle roi vao ngay Chu Nhat...");
    // current month
    SimpleDateFormat mformat = new SimpleDateFormat("MM/yyyy");
    String currentMonth = mformat.format(new Date());
    System.out.println("Current month: " + currentMonth);

    Calendar calendar = Calendar.getInstance();

    // Lay ra ngay 15 hang thang
    calendar.set(Calendar.DATE, 15);
    int count = 0;
    int month = 0;
    for (int i=1; i<=24; i++){ // tim trong 2 nam
      calendar.add(Calendar.MONTH, month); // thang hien tai
      calendar.get(Calendar.DAY_OF_WEEK);
      String date_time = calendar.getTime().toString();
      String day_of_week = date_time.substring(0, 3);
      if(day_of_week.equals("Sun")){
      System.out.println("Ngay dong Cycle ==> " + date_time);
      count++;
      month++;
      }
      else
      System.out.println("Nothing...");
    }
    System.out.println("Co tong cong " + count + " ngay.");
  }
}